<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>文章详情页面</title>
</head>
<body>
	<b>${msg}</b><br><br>
	<c:if test="${blogContent.userId == user.id}">
	<a href="/edit?id=${blogContent.id}">编辑</a> | <a href="javascript:del()">删除</a></br>
	</c:if>
	${blogContent.title}</br>
	${blogContent.content}<br>
	------------------------------<br>
	<c:forEach items="${blogComments}" var="blogComment">
		${blogComment.content} &nbsp;&nbsp;&nbsp;&nbsp;<img width="30px" height="30px" src="${blogComment.headImg}"> ${blogComment.nikeName} 
		${blogComment.createTime}
		<br>
	</c:forEach>
	------------------------------<br>
	<c:choose>
	<c:when test="${user!=null}">
		<form action="/add_comment" method="post">
			<input type="hidden" name="blogContentId" value="${blogContent.id}"/>
			<input type="hidden" name="blogUserId" value="${user.id}"/>
			评论：<input name="content" value=""/>
			<input type="submit" value="提交">
		</form>
	</c:when>
	<c:otherwise>
		你可以 <a href="#">登录后评论</a>
	</c:otherwise>
	</c:choose>
	<script>
		function del() {
			var msg = "您真的确定要删除吗？\n\n请确认！";
			if (confirm(msg)==true){
				window.location="/del?id=${blogContent.id}";
				return true;
			}else{
				return false;
			}	
		}
	</script>
</body>
</html>